package org.lsc.lesson4configclient.config;

import org.springframework.core.env.EnumerablePropertySource;

import java.util.Map;

/**
 * @Author 刘事成
 * @Date 2018/10/11
 * @Time 9:48
 * @Description:研究系列
 */
public class PropertySource extends EnumerablePropertySource<Map<String,String>> {


    public PropertySource(String name, Map source) {
        super(name, source);
    }
    //获取所有的配置名字
    @Override
    public String[] getPropertyNames() {
        return source.keySet().toArray(new String[source.size()]);
    }

    //根据配置返回对应的属性
    @Override
    public Object getProperty(String name) {
        return source.get(name);
    }


}
